<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('用户信息列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>账号：</label>
                            <input type="text" name="accountName"/>
                        </li>
                        <li>
                            <label>手机号：</label>
                            <input type="text" name="phone"/>
                        </li>
                        <li>
                            <label>教育类型：</label>
                            <select name="eduLevel" th:with="type=${@dict.getType('learn_type')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <input type="text" name="status" value="1" hidden/>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <input type="text" id="examId" th:value="${examId}" hidden/>
        <div class="btn-group-sm" id="toolbar" role="group">
            <!-- <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="base:userInfo:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
               shiro:hasPermission="base:userInfo:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="base:userInfo:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="base:userInfo:export">
                 <i class="fa fa-download"></i> 导出
             </a>-->
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">

    var statusDatas = [[${@dict.getType('learn_type')}]];
    var prefix = ctx + "base/userInfo";


    $(function () {
        var options = {
            url: prefix + "/list",
            showSearch: false,
            showRefresh: false,
            showColumns: false,
            showToggle: false,
            clickToSelect: true,
            rememberSelected: true,
            modalName: "用户信息",
            columns: [{
                checkbox: true
            },
                {
                    field: 'userId',
                    title: '',
                    visible: false
                },
                {
                    field: 'accountName',
                    title: '账号'
                },
                {
                    field: 'phone',
                    title: '手机号'
                },

                {
                    field: 'sysName',
                    title: '所属系统'
                },
                {
                    field: 'postName',
                    title: '岗位'
                },
                {
                    field: 'learnDuration',
                    title: '学习时长(分钟)'
                },
                {
                    field: 'education',
                    title: '学历'
                },
                {
                    field: 'eduLevel',
                    title: '教育类别',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(statusDatas, value);
                    }
                }]
        };
        $.table.init(options);
    });

    function submitHandler() {
        var userIds = $.table.selectColumns("userId").toString();
        if (userIds.length==0){
            $.modal.alertError("未选择对象")
            return
        }
        var data ={
            examId: $("#examId").val(),
            userIds: userIds
        }
        $.modal.confirm("是否确认发放试卷到对象", function () {
            $.post(ctx + "web/examReslut/sendExamToUser",data , function (result) {
                $.operate.saveSuccess(result);
            })
        })
    }
</script>
</body>
</html>